﻿<%@ Register TagPrefix="uc1" TagName="ControlProjectTreeView" Src="/Inc/ControlProjectTreeView.ascx" %>
<%@ Page language="c#" Codebehind="ProjectTreeView.aspx.cs" AutoEventWireup="false" Inherits="UDS.TreeView" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-cn" />
<meta name="author" content="Herry" />
<meta name="Copyright" content="Copyright (c) 2009 himm.cn" />
<title>左边菜单</title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" type="text/css" href="/css/Nav.css" media="screen" />

</head>

<body onload="SetStatus()" style="overflow-x:hidden">
		<form id="Projecttreeview" method="post" runat="server">
		<dl>
		    <dt><span><asp:image id="Image1" runat="server" ImageUrl="/DataImages/xpDesktop.gif"></asp:image><a href="Desktop.aspx" target="MainFrame">桌面(<%=UserName%>)</a></span></dt>
		    <dd><uc1:controlprojecttreeview id="ControlProjectTreeView1" runat="server"></uc1:controlprojecttreeview></dd>
		</dl>

		</form>
		<script language="javascript">
		function SetStatus()
		{
			try{				
				myTreeView = document.all.ControlProjectTreeView1_TreeView1;
				var urlstr=location.href.split("?")[1];
				if (urlstr!=null)
					{
						urlstr=urlstr.split("classID=")[1];
						var classID=urlstr.split("&")[0];//取得classID值
						var mNodeArray=new Array();
						mNodeArray=myTreeView.getChildren();
						CheckAll(mNodeArray,classID);
						mNodeArray=null;
					}
				}
			catch(e){alert('error occur!'+e);}
		}
		
		function ExpandAllParentNode(node)
		{
						
				if(node!=null){
					node.setAttribute("Expanded","True");
					ExpandAllParentNode(node.getParent());
				}
		}
		
		
		function CheckAll(arr,classID)
		{
			var i;
			for(i=0;i<arr.length;i++)
			{
					var mNode=arr[i];
					var currNodeID	= mNode.getAttribute("ID");
					if(currNodeID==classID)
					{
						ExpandAllParentNode(mNode);
						break;
					}
					if((mNode.getChildren().lengh)!=0)
					CheckAll(mNode.getChildren(),classID);//递归遍历节点
			}
	    }

		</script>
	</body>
</html>